<?php 
@header("Content-Type:text:html;charset=utf-8");
@include_once("conn.php");
@include_once("common.php");

if(!(isset($_GET["userName"])&& isset($_GET["goodsId"]))){
    paramsErr();
}

// $id=$_GET["id"];
$userName=$_GET["userName"];
// $goodsImg=$_GET["goodsImg"];
// $goodsName=$_GET["goodsName"];
// $goodsPrice=$_GET["goodsPrice"];
$goodsId=$_GET["goodsId"];



// $sql="insert into `mylike`(goodsImg,goodsName,goodsPrice,userName,goodsId) values('$goodsImg','$goodsName','$goodsPrice','$userName','$goodsId')";
$sql="delete from `mylike` where goodsId='$goodsId' and userName='$userName'";
$result=mysqli_query($conn,$sql);
$obj=array();
if($result){
    $rows=mysqli_affected_rows($conn);
    if($rows > 0){
        $obj["status"] = true;
        $obj["msg"] = "删除成功";
    }else{  // 注册不会出现此情况
        $obj["status"] = false;
        $obj["msg"] = "删除失败,未查询到该数据";
    }
}else{
    $obj["status"] = false;
    $obj["msg"] = "sql语句有误";
    $obj["sql"] = $sql;
} 
echo json_encode($obj);
?>